package com.common.utils;

import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;

public class WebUtils extends org.apache.shiro.web.util.WebUtils {
	
	private WebUtils() {
		throw new AssertionError();
	}
	
	/**
	 * 判断http请求是否为ajax请求
	 * @param request
	 * @return
	 * @author lj
	 * @date 2017年5月25日 下午4:18:54
	 */
	public static boolean isAjaxRequest(ServletRequest request) {
		HttpServletRequest httpServletRequest = toHttp(request);
		String requestType = httpServletRequest.getHeader("X-Requested-With");
		return StringUtils.isEquals(requestType, "XMLHttpRequest");
	}

}
